type Constructor<T = any> = new (...args: any[]) => T;
type User = {
  id: number;
  name: string;
};
function ClassDecorator<T extends Constructor<User>>(target: T) {
  target.prototype.name = "我是name属性";
}
@ClassDecorator // 这里会报错，因为ClassDecorator在使用约束后不再支持对除了User之外的类 进行修饰
class A {
  name: string;
  constructor(public id: number) {}
} // 添加属性
@ClassDecorator
class AA {
  constructor(public id: number, public name: string) {}
}
